-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

=============================================================================
FreeBSD-SA-23:02.openssh                                    Security Advisory
                                                          The FreeBSD Project

Topic:		OpenSSH pre-authentication double free

Category:       contrib
Module:         openssh
Announced:      2023-02-16
Credits:        Mantas Mikulenas
Affects:        FreeBSD 12.4
Corrected:      2023-02-08 21:06:22 UTC (stable/13, 13.2-STABLE)
                2023-02-08 21:07:30 UTC (stable/12, 12.4-STABLE)
                2023-02-16 18:04:07 UTC (releng/12.4, 12.4-RELEASE-p2)
CVE Name:       CVE-2023-25136

For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit <URL:https://security.FreeBSD.org/>.

0.   Revision History

v1.0  2023-02-16 -- Initial release
v1.1  2022-03-01 -- Corrected stable/13 Correction details

I.   Background

OpenSSH is an implementation of the SSH protocol suite, providing an
encrypted and authenticated transport for a variety of services,
including remote shell access.

II.  Problem Description

A flaw in the backwards-compatibility key exchange route allows a pointer
to be freed twice.

III. Impact

A remote, unauthenticated attacker may be able to cause a denial of service,
or possibly remote code execution.

Note that FreeBSD 12.3 and FreeBSD 13.1 include older versions of OpenSSH,
and are not affected.  FreeBSD 13.2-BETA1 and later include the fix.

IV.  Workaround

No workaround is available.

V.   Solution

Upgrade your vulnerable system to a supported FreeBSD stable or
release / security branch (releng) dated after the correction date.

Perform one of the following:

1) To update your vulnerable system via a binary patch:

Systems running a RELEASE version of FreeBSD on the amd64, i386, or
(on FreeBSD 13 and later) arm64 platforms can be updated via the
freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install

2) To update your vulnerable system via a source code patch:

The following patches have been verified to apply to the applicable
FreeBSD release branches.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

[FreeBSD 12.4]
# fetch https://security.FreeBSD.org/patches/SA-23:02/openssh.patch
# fetch https://security.FreeBSD.org/patches/SA-23:02/openssh.patch.asc
# gpg --verify openssh.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Recompile the operating system using buildworld and installworld as
described in <URL:https://www.FreeBSD.org/handbook/makeworld.html>.

Restart the applicable daemons, or reboot the system.

VI.  Correction details

This issue is corrected by the corresponding Git commit hash or Subversion
revision number in the following stable and release branches:

Branch/path                             Hash                     Revision
- -------------------------------------------------------------------------
stable/13/                              296ec8eae0c8    stable/13-n254414
stable/12/                                                        r372919
releng/12.4/                                                      r372938
- -------------------------------------------------------------------------

For FreeBSD 13 and later:

Run the following command to see which files were modified by a
particular commit:

# git show --stat <commit hash>

Or visit the following URL, replacing NNNNNN with the hash:

<URL:https://cgit.freebsd.org/src/commit/?id=NNNNNN>

To determine the commit count in a working tree (for comparison against
nNNNNNN in the table above), run:

# git rev-list --count --first-parent HEAD

For FreeBSD 12 and earlier:

Run the following command to see which files were modified by a particular
revision, replacing NNNNNN with the revision number:

# svn diff -cNNNNNN --summarize svn://svn.freebsd.org/base

Or visit the following URL, replacing NNNNNN with the revision number:

<URL:https://svnweb.freebsd.org/base?view=revision&revision=NNNNNN>

VII. References

<URL:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25136>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-23:02.openssh.asc>
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmQAFWYACgkQbljekB8A
Gu9QvA//fTfUZsc+p8ElVqCiVjvMukyLbIA9uPzGeUWoDOwB8ke1VMck8gwsBhTD
vEFpf8N79SXrZrYVcCjUtzrUbAIeCKpahnfiFL8TrZZx0oO20gqo0L01UFqJXJzz
954o6ddQ5G2z6Td3fT23ZdBD2iOD5iN7rEg7QEeRHGyhhC0qNcyZiT3icZin/dkR
h4ihCWsgtdI/amhYKaLtajAgV0X+Oibms6ANYGYdYAqeN1MSqMb0wrU5mj8iRVFO
vX6aBybcaKUbW1Hxh1zUR3h8Og1moNqJ6DzOP7PRqKp6bqCcupfT6ydZumWS4pvo
gYlaN8pU3T9EKmwMHqulcwI5ArGleYfaLso+gwpeL77Gb/rNXmVnGTv8ursfP/4k
sRoLmmdeM6Phla1dH5KJdDF7xZSWqeCoMCdLiZZ0K0sgwlOaqe/r/CAoM8CYWIjS
U76zjZmkzBTDsPa4REk37NXFBeB4UsPbNuORd7BuUyRPpmMVbV4DpyAxK8Sx8fzQ
bwZSSoHjnl3yaFIoCHrinlYlb7MiQSObD16bPrnbQCtPoi3lakYru+ywvkIRhGo5
1R8xRhoxPKtPdFn+P59qrFZVfCd8TAEW5S/HlL/Mu2h9EyDAKfwVY9ak04MwScTY
OTgAd768GplUPZhsgOuwf4CYry/dXEIJ8O0SLh0MEuuuGBoVxjc=
=YxkN
-----END PGP SIGNATURE-----
